<script setup lang="ts">
import MpHtml from 'mp-html/src/uni-app/components/mp-html/mp-html.vue'
import { useGeneralDataStore } from '@/store/generalData'

const generalDataStore = useGeneralDataStore()
const type = ref<'用户协议' | '隐私协议' | '免责协议' | '预约协议' | '积分商城兑换说明' | ''>('')

onLoad((options) => {
  if (options && options.type) {
    type.value = options.type
    uni.setNavigationBarTitle({ title: type.value })
  }
})

const content = computed(() => {
  return generalDataStore.generalData?.base
    .find(item => item.title === type.value)?.content || ''
})
</script>

<template>
  <view class="p-24rpx">
    <MpHtml :content="content" />
  </view>
</template>

<route lang="yaml">
name: 'protocol'
layout: 'custom'
</route>
